<script>
  import $ from '../dfish.js'
  import Dialog from './Dialog.vue'

  export default {
    name: 'w-alert',
    mixins: [Dialog],
    props: ['text', 'yes', 'no'],
    methods: {
      cueYes() {
        this.close()
      },
      cueNo() {
        this.close()
      },
      cue(a) {
        if ($.isCmd(a)) {
          this.commander.exec(a, this.args)
        } else if (typeof a === 'function') {
          a(this.args)
        }
      },
    },
    computed: {
      html_class() {
        return ['w-dialog w-vertical', this.animateClass, this.snapClass]
      }
    },
    mounted() {
      if (this.isEntity) {
        this.addEvent('close', () => this.$options.name == 'w-alert' ? this.cue(this.x.yes) : this.cue(this.x.no))
      }
    }
  }
</script>

<style>

</style>
